# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pytest-django
pkgver=4.7.0
pkgrel=0
pkgdesc="Django plugin for pytest"
url="https://pytest-django.readthedocs.io/"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-pytest"
makedepends="py3-setuptools py3-setuptools_scm py3-wheel"
checkdepends="py3-pytest py3-pytest-xdist py3-django"
subpackages="$pkgname-pyc"
source="https://github.com/pytest-dev/pytest-django/archive/refs/tags/v$pkgver/py3-pytest-django-$pkgver.tar.gz"
builddir="$srcdir/pytest-django-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	python3 setup.py build
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 setup.py install
	# needs pytest_django_test from project root
	PYTHONPATH="$PWD" \
	DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite_file \
		testenv/bin/python3 -m pytest
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
090337442568b43e9da4ec2b3d0c1f862e44c90a3852906338928a968e4fa89ef9e9e930f43d067e48dde317aeba465ec374be9d5ec74c835ad7e1cea9cba93b  py3-pytest-django-4.7.0.tar.gz
"
